package br.ufc.si.sd.controle;




import br.ufc.si.sd.proxy.AgendaProxy;
import com.google.protobuf.InvalidProtocolBufferException;
import java.util.List;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import protos.br.ufc.si.sd.gerado.AgendaEletronica.Person;
import protos.br.ufc.si.sd.gerado.Message.RequestMessage;


/**
 *
 * @author Usuario
 */
public class AgendaControle {
   private AgendaProxy proxy;
   
   
   public AgendaControle(){
   
   proxy= new AgendaProxy();
   }
    public String addPerson(Person person) throws InvalidProtocolBufferException {
       //proxy= new AgendaProxy();
       RequestMessage.Builder request = RequestMessage.newBuilder();
       request.setMetodo("addPerson");
       request.setArgs(person.toByteString());
       return proxy.addPerson(request);
    }

     public String registrar(Person person) throws InvalidProtocolBufferException {
       //proxy= new AgendaProxy();
       RequestMessage.Builder request = RequestMessage.newBuilder();
       request.setMetodo("registrar");
       request.setArgs(person.toByteString());
       return proxy.registrar(request);
    }

    public String editaPerson(Person person) throws InvalidProtocolBufferException {
       return proxy.editarPerson(person);
    }

    public String removePerson(Person person) throws InvalidProtocolBufferException {
        return proxy.removerPerson(person);
    }
    
    public Person buscarPerson(Integer person) throws InvalidProtocolBufferException {
        return proxy.buscaPerson(person);
    }

    public List<Person> listaPerson() throws InvalidProtocolBufferException {
      
        return proxy.listarPerson();
    }

    
    
    
    
    

}
